#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 5000

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["Wuther.Api/Wuther.Api.csproj", "Wuther.Api/"]
COPY ["Wuther.Bussiness.Service/Wuther.Bussiness.Service.csproj", "Wuther.Bussiness.Service/"]
COPY ["Wuther.Bussiness.Interface/Wuther.Bussiness.Interface.csproj", "Wuther.Bussiness.Interface/"]
COPY ["Wuther.Entities/Wuther.Entities.csproj", "Wuther.Entities/"]
COPY ["Wuther.Util/Wuther.Util.csproj", "Wuther.Util/"]
RUN dotnet restore "Wuther.Api/Wuther.Api.csproj"
COPY . .
WORKDIR "/src/Wuther.Api"
RUN dotnet build "Wuther.Api.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Wuther.Api.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Wuther.Api.dll"]